const t = "transform:translateY(15px);";

function getTranslateY(elem) {
    if(elem){
        const match = elem.match(/translateY\(([^\)]+)\)/);
        return match ? match[1] : "";
    }
}

const html = "<div class='test'><b>Hello</b><i>world!</i></div>";
const results = html.match(/<(\/?)(\w+)([^)]*?)>/);
const all = html.match(/<(\/?)(\w+)([^)]*?)>/g);
const tag = /<(\/?)(\w+)([^)]*?)>/g;
let match , num = 0;
// while ((match = tag.exec(html)) !== null) {
//     console.log(match);
//     num ++;
// }

const html1 = "<b class='hello'>Hello</b> <i>world!</i>";
const pattern = /<(\w+)([^>]*)>(.*?)<\/\1>/g;
const p1 = pattern.exec(html1)
const p2 = pattern.exec(html1)
console.log(p1)
console.log(p2)

// 获取捕获
// console.log("fontFamily".replace(/([A-Z])/g, "-$1").toLocaleLowerCase())

//将短线来连接的字符串转换为"驼峰式"字符串

function upper(all, letter) {
    return letter.toUpperCase();
}
let a = "boder-bottom-width".replace(/-(\w)/g, upper);

let b = "foo=1&foo=2&blah=a&blah=b&foo=3";

function compress(source) {
    const keys = {};
    source.replace(/([^=&]+)=([^&]*)/g, function (full, key, value) {
        keys[key] = (keys[key] ? keys[key] + ",":"") + value;
        return "";
    })
}
compress(b)
